//
//  PmsSingleBlueButton.swift
//  PMS
//
//  Created by haotianz on 15/10/31.
//  Copyright © 2015年 途家. All rights reserved.
//

import Foundation

public class PmsSingleBlueButton: UIButton {
    public init(width:CGFloat) {
        super.init(frame: CGRect.zero)
        
        self.frame = CGRect(x: 10, y: 0, width: width, height: 45)
        self.backgroundColor = CommonColors.c_536dfe
        self.setTitle("保存", for: UIControl.State())
        self.setTitleColor(UIColor.white, for: UIControl.State())
        self.titleLabel?.font = UIFont.systemFont(ofSize: 18)
        self.addTarget(self, action: #selector(PmsSingleBlueButton.setBackgroundColorForTouchDown), for: .touchDown)
        self.addTarget(self, action: #selector(PmsSingleBlueButton.setBackgroundColorForTouchUp), for: .touchUpInside)
        self.addTarget(self, action: #selector(PmsSingleBlueButton.setBackgroundColorForTouchUp), for: .touchUpOutside)
        self.layer.cornerRadius = 4
    }

    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    @objc public func setBackgroundColorForTouchDown() {
        self.backgroundColor = CommonColors.c_3f51b5
    }
    
    @objc public func setBackgroundColorForTouchUp() {
        self.backgroundColor = CommonColors.c_526dfe
    }

}
